/* 
* @Author: Jerry-chen
* @Date:   2014-07-10 02:08:04
* @Last Modified by:   Jerry-chen
* @Last Modified time: 2014-07-14 14:34:25
*/

                $(function(){
                   
                    $('#goodstitle').change(function() {
                        //清除HTML代码
                        $('.adinfostr').empty();
                        //获得goodsid
                         var goodsid = $(this).val();
                 $.ajax({
                        url: APP + '&c=Ad&m=ajax_goodsinfo',
                        type: 'post',
                        dataType: 'json',
                        data: {'goodsid' : goodsid},
                       success:function(adinfo){
                       	//定义字符串
                       	var adinfostr="";
                       	if(adinfo==0){
                       		adinfostr +="<tr><th width='120' class='w100'>错误信息</th><td style='color:red;'>请先选择正确您要推荐的商品</td></tr>";
                       	}else{
                       		// 下面的隐藏域，用的是GOODSID，为了是在后面判断，把GOODSID当成键接的GET传参
                       		 adinfostr += "<tr><th width='120' class='w100'>Banner标题</th><td><input style='width:180px;' type='text' value='"+adinfo.adtitle+"' name='adtitle0' /></td></tr><tr><th width='120' class='w100'>Banner图片路径</th><td><input style='width:180px;' type='text' value='"+adinfo.adpic+"' name='adpic0' />您也可以更换成网络图片路径，或其它路径</td></tr><tr><th width='120' class='w100'>Banner标题</th><td><p>无法更改键接</p><input type='hidden' name='adlink0' value='"+adinfo.goodsid+"' /></td></tr>"
                       	}
                       	
						 $('.adinfostr').append(adinfostr);     
					}
           		 })
             });
           });
